import React, {Component} from "react"
import {Redirect} from "react-router-dom"

/**主界面**/
class Home extends Component {
    constructor(props) {
        super(props);
        this.state = {
            button1: false,
            button2: false,
            button3: false,
            button4:false
        };
        this.activityButton1 = this.activityButton1.bind(this);
        this.activityButton2 = this.activityButton2.bind(this);
        this.activityButton3 = this.activityButton3.bind(this);
        this.activityButton4 = this.activityButton4.bind(this);
    }

    activityButton1() {
        this.setState({
            button1: true
        });
    }

    activityButton2() {
        this.setState({
            button2: true
        });
    }

    activityButton3() {
        this.setState({
            button3: true
        });
    }

    activityButton4() {
        this.setState({
            button4: true
        });
    }

    render() {
        if (this.state.button1) {
            return <Redirect to={"/activity"}/>
        }
        if (this.state.button2) {
            return <Redirect to={"/recommendateAlumnu"}/>
        }
        if (this.state.button3) {
            return <Redirect to={"/queryAlumnu"}/>
        }
        if (this.state.button4) {
            return <Redirect to={"/studentVerify"}/>
        }
        return (
            <div className="index_container">
                <hr className="hr"/>
                <ul className="login_content">
                    <li>
                        <button className="index_button_4" onClick={this.activityButton4}>身份验证与完善信息</button>
                    </li>
                    <li>
                        <button className="index_button_1" onClick={this.activityButton1}>活动查看与发起</button>
                    </li>
                    <li>
                        <button className="index_button_2" onClick={this.activityButton2}>推荐校友</button>
                    </li>
                    <li>
                        <button className="index_button_3" onClick={this.activityButton3}>校友查询</button>
                    </li>
                </ul>
            </div>
        )
    }
}

export default Home;


